<html>
<head><meta charset="utf-8"><title>attributes on const params · project-const-generics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/index.html">project-const-generics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/attributes.20on.20const.20params.html">attributes on const params</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="216396429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/attributes%20on%20const%20params/near/216396429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/attributes.20on.20const.20params.html#216396429">(Nov 11 2020 at 20:42)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(min_const_generics)]</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="cp">#[inline]</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
</code></pre></div>
<p>is syntactically allowed and not verified so it successfully compiles. IMO this is blocking stabilization, opened <a href="https://github.com/rust-lang/rust/issues/78957">#78957</a></p>



<a name="216396490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/attributes%20on%20const%20params/near/216396490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/attributes.20on.20const.20params.html#216396490">(Nov 11 2020 at 20:43)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> you recently fixed nearly the same issue for enum variants, is this something you are interested in?</p>



<a name="216396542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/attributes%20on%20const%20params/near/216396542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/attributes.20on.20const.20params.html#216396542">(Nov 11 2020 at 20:43)</a>:</h4>
<p>I’ll take a look</p>



<a name="216396615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/attributes%20on%20const%20params/near/216396615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/attributes.20on.20const.20params.html#216396615">(Nov 11 2020 at 20:44)</a>:</h4>
<p>just curious, does this actually do anything?</p>



<a name="216396631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/attributes%20on%20const%20params/near/216396631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/attributes.20on.20const.20params.html#216396631">(Nov 11 2020 at 20:44)</a>:</h4>
<p>no, it just gets ignored</p>



<a name="216398085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/attributes%20on%20const%20params/near/216398085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/attributes.20on.20const.20params.html#216398085">(Nov 11 2020 at 20:57)</a>:</h4>
<p>seems like the same issue also exists for other generic params</p>



<a name="216400986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/attributes%20on%20const%20params/near/216400986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/attributes.20on.20const.20params.html#216400986">(Nov 11 2020 at 21:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/260443-project-const-generics/topic/attributes.20on.20const.20params/near/216398085">said</a>:</p>
<blockquote>
<p>seems like the same issue also exists for other generic params</p>
</blockquote>
<p>if it's not unique to const generics, maybe it doesn't need to block stabilization?</p>



<a name="216401008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/attributes%20on%20const%20params/near/216401008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/attributes.20on.20const.20params.html#216401008">(Nov 11 2020 at 21:27)</a>:</h4>
<p>it still should <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="216401009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/attributes%20on%20const%20params/near/216401009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/attributes.20on.20const.20params.html#216401009">(Nov 11 2020 at 21:27)</a>:</h4>
<p>(I really want <a href="https://github.com/rust-lang/rust/pull/65819">https://github.com/rust-lang/rust/pull/65819</a> on stable <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> )</p>



<a name="216460410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/attributes%20on%20const%20params/near/216460410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/attributes.20on.20const.20params.html#216460410">(Nov 12 2020 at 12:23)</a>:</h4>
<p>Ignored attributes have been a real pain to fix in the past, because it's technically breaking to start erroring on them. I agree with <span class="user-mention" data-user-id="216206">@lcnr</span> that we should fix the issues with const parameters now to avoid those problems.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>